Birmingham | ITP-Jan | Ahmad Roman Sanaye | Sprint 3 | Implement functions and rewrite tests #1119
Conversation
This comment has been minimized.
This comment has been minimized.
Sprint-3/1-implement-and-rewrite-tests/implement/1-get-angle-type.js
Outdated
Show resolved
Hide resolved
| // TODO: Implement this function | ||
| if(numerator <= 0 || denominator <= 0){ | ||
| return false; | ||
| }else if(numerator < denominator){ |
There was a problem hiding this comment.
Can you check if 1/-2, -1/2, -1/-2 are consider proper fractions, and then update the implementation and tests accordingly?
There was a problem hiding this comment.
Thank you for the suggestion — it was very useful. I checked 1/-2, -1/2, and -1/-2; all are proper fractions. I updated the isProperFraction function and tests using Math.abs() to handle these cases.
| }else if(rank.match(/J|Q|K/)){ | ||
| return 10; | ||
| }else if(rank.match(/^(10|[2-9])$/)){ |
There was a problem hiding this comment.
Does your function return the value you expected from each of the following function calls?
getCardValue("0x02♠");
getCardValue("QQ♠");
getCardValue("2.1♠");
There was a problem hiding this comment.
Thank you for pointing this out. I have tested the function with getCardValue("0x02♠"), getCardValue("QQ♠"), and getCardValue("2.1♠"); all now correctly throw an "Invalid card" error as expected. I also added Jest tests to cover these edge cases.
This comment has been minimized.
This comment has been minimized.
Sprint-3/1-implement-and-rewrite-tests/implement/3-get-card-value.js
Outdated
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Outdated
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
Show resolved
Hide resolved
Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js
Outdated
Show resolved
Hide resolved
clear
Outdated
There was a problem hiding this comment.
If this file is not related to the exercise, please remove it to keep the PR branch clean.
There was a problem hiding this comment.
Can you address this comment?
There was a problem hiding this comment.
If you are talking about (isproperFracction) then it is part of the exercises. other case, I did not get what you are pointing at.


Learners, PR Template
Self checklist
Changelist
getCardValuefunction to properly validate card ranks using/^[JQK]$/for face cards instead of/J|Q|K/."0x02♠","QQ♠","2.1♠".A)2–10)J, Q, K)get-angle-typecode using Prettier extension for consistent style.Testing